package pers.lt.fileupload.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import pers.lt.fileupload.services.FileUploadServices;
import pers.lt.hibernatebeans.AttachInfoEntity;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by 18621 on 2016/8/17.
 */
@Controller
@RequestMapping(value = "/fileupload")
public class FileUploadController {
    @Resource
    private FileUploadServices fileUploadServices;
    @RequestMapping(value = "/go.html")
    @ResponseBody
    public AttachInfoEntity fileupload(MultipartHttpServletRequest request, HttpServletResponse response) throws IOException {
        //request.getSession().getServletContext();
        return fileUploadServices.saveFJ(request);
    }
}
